#ifndef MG_RS485CONFIG_H
#define MG_RS485CONFIG_H
#include "ite/itp.h" //for all ith driver (include GPIO) & MACRO
#include <sys/ioctl.h>
#include <unistd.h>


typedef enum _BAUD_TYPE
{
	BAUD_1200 = 1200,
	BAUD_2400 = 2400,
	BAUD_4800 = 4800,
	BAUD_9600 = 9600,
	BAUD_19200 = 19200,
	BAUD_38400 = 38400,
	BAUD_43000 = 43000,
	BAUD_56000 = 56000,
	BAUD_57600 = 57600,
	BAUD_115200 = 115200,
}enumBaudType;

#define	 USART_BAUDRATE		BAUD_19200	//波特率	

#define RS485_INT_PIN		22	   		//接受中断端口

#define RS485_PORT       ITP_DEVICE_RS485_1
#define RS485_DEVICE     itpDeviceRS485_1
#define RS485_BAUDRATE   CFG_RS485_1_BAUDRATE
#define RS485_GPIO_RX    CFG_GPIO_RS485_1_RX

//RS485使能发送
extern void EnableRS485Tx(void);
//RS485使能接收	 
extern  void DisableRS485Tx(void);
//RS485使能脚初始化 
extern  void RS485DeReInit(void);
//RS485初始化
extern void RS485Init(void);
//使能发送时钟(us)
extern void RS485SendTimEnable(uint16_t time);
//停止发送时钟
extern void RS485SendTimDisable(void);
//485串口接收
int Uart1_Recieve(char* RecieveData);
//清空底层缓存
void Clean_Rs485_Data(void);
//485串口发送
void Uart1_Send(uint8_t* SendData, uint8_t DataLen);
#endif